package com.esfak47.mediafetcher.app.controller;

import com.esfak47.common.PageResult;
import com.esfak47.common.Result;
import com.esfak47.mediafetcher.core.domain.Media;
import com.esfak47.mediafetcher.core.service.MediaStorage;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author tony
 * @date 2018/5/7
 */
@RestController
public class MediaController {

    @Resource
    private MediaStorage mediaStorage;

    @GetMapping("mediaList")
    public Result<PageResult<Media>> getMedias(int page, int pageSize) {
        PageResult<Media> page1 = mediaStorage.getPage(page - 1, pageSize);
        return Result.success(page1);
    }
}
